<%@ taglib prefix="c"   uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="http://micronova.com/yuzu" prefix="m"%> 
<%@page import = "com.db4o.ext.ExtObjectContainer" %>
<%@page import = "com.db4o.servlet.Db4oServlet" %>
<%@page import = "facades.*" %>
<%@page import = "auser.*" %>
<%@page import = "java.util.*" %>
<c:if test="${empty editBar}"><c:redirect url="/app/start/index.jsp" /> </c:if>
<% SessionFacade sfacade = new SessionFacade(session); %>
<% Map prop = new java.util.Hashtable(request.getParameterMap()); %> 
<% sfacade.setSessionBean("editBar",prop); %>
<% MovimentoBar beditBar= (MovimentoBar)session.getAttribute("editBar") ; %>

<c:set var='valid' value='${true}' />

<c:if test="${empty param.descrizione}">
	<c:set var='eDescrizione' value='necessario'  scope='request'/>
	<c:set var='valid' value='${false}' />
</c:if>

<c:if test="${empty param.dataMovimento}">
	<c:set var='eDataMovimento' value='necessario'  scope='request'/>
	<c:set var='valid' value='${false}' />
</c:if>

<c:if test="${empty param.annoCompetenza}">
	<c:set var='eAnnoCompetenza' value='necessario'  scope='request'/>
	<c:set var='valid' value='${false}' />
</c:if>

<c:if test="${editBar.entrata==0 && editBar.uscita==0}">
	<c:set var='eErroreImporto' value='Entrata o Uscita necessaria'  scope='request'/>
	<c:set var='valid' value='${false}' />
</c:if>


<c:if test="${valid}">
	<c:if test="${editBar.progressivoOperazione==null || editBar.progressivoOperazione==0}">
		<jsp:setProperty name="editBar" property="progressivoOperazione" value="<%=sfacade.getNext(MovimentoBar.class,beditBar.getAnnoCompetenza()) %>"/>
	</c:if>
	<% sfacade.setFromSession("editBar",true); %> 
	< c:redirect url="/app/start/index.jsp" />
</c:if>



<c:if test="${!valid}">
	<jsp:forward page="edit.jsp" />
</c:if>